/**
 * 
 */
package remato.client.view.projecttree;

import static remato.client.controller.PrecisePluginImage.IMG_CREATE_STAKEHOLDER;
import remato.client.controller.RequirementPlugin;
import remato.client.model.UseCaseDefinitionWrapper;
import remato.client.model.facade.ModelSystem;
import remato.domain.common.UseCaseDefinition;

/**
 * @author Petter L. H. Eide
 *
 */
public class CreateUseCaseDefinitionAction extends CreateAction<UseCaseDefinitionWrapper, ModelSystem<UseCaseDefinitionWrapper>> {

    public CreateUseCaseDefinitionAction() {
        super(createText(UseCaseDefinition.class.getSimpleName()), null, IMG_CREATE_STAKEHOLDER.getImageDescriptor());
    }

    /**
     * @see remato.client.view.projecttree.CrudAction#run()
     */
    @Override
    public void run() {
    	ModelSystem<UseCaseDefinitionWrapper> system = RequirementPlugin.getInstance().getSession().getWrapperFactory().getSystem(UseCaseDefinitionWrapper.class);
    	setItem(system);
    	UseCaseDefinition useCaseDefinition = RequirementPlugin.getInstance().getSession().getDomainSession().createConcept(UseCaseDefinition.class);
        UseCaseDefinitionWrapper item = RequirementPlugin.getInstance().getSession().getWrapperFactory().getWrapper(useCaseDefinition);
        item.setParent(system);
        setNewItem(item);
        super.run();
    }

}
